package com.two.zelin.controller;
//添加订单
import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.two.zelin.service.orderService;
import com.two.zelin.service.impl.orderServiceImpl;
@WebServlet("/addorder.do")
public class addorderServlet extends HttpServlet{

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		this.doPost(req, resp);
		
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf-8");
		resp.setCharacterEncoding("UTF-8");
		String fukuan = req.getParameter("fukuan");
		String spname = req.getParameter("spname");
		String spid = req.getParameter("spid");
		String jage = req.getParameter("jage");
		String zhekou = req.getParameter("zhekou");
		String shouhuo = req.getParameter("shouhuo");
		orderService service = new orderServiceImpl();
		boolean result = service.addorder(fukuan, spname, spid, jage, zhekou,shouhuo);
		System.out.println("添加结果：" + result);
		req.getRequestDispatcher("view/zelin/sptianjiadingdan.html").forward(req, resp);
		
	}
	
}
